package com.synergy.stockflow.product.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.synergy.stockflow.warehouse.entity.InventoryTransaction;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

@Schema
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "material")
public class Material {
    /**
     * 物料编码
     */
    @TableId(value = "material_id", type = IdType.ASSIGN_ID)
    @Schema(description="物料编码")
    private String materialId;

    /**
     * 物料名称
     */
    @TableField(value = "material_name")
    @Schema(description="物料名称")
    private String materialName;

    /**
     * 规格型号
     */
    @TableField(value = "specifications_and_models")
    @Schema(description="规格型号")
    private String specificationsAndModels;

    /**
     * 单位
     */
    @TableField(value = "unit")
    @Schema(description="单位")
    private String unit;

    /**
     * 物料/产品
     */
    @TableField(value = "material_or_product")
    @Schema(description="物料/产品")
    private String materialOrProduct;

    /**
     * 所属分类名称
     */
    @TableField(value = "category")
    @Schema(description="所属分类名称")
    private String category;

    /**
     * 是否启用(1=是, 0=否)
     */
    @TableField(value = "is_enabled")
    @Schema(description="是否启用(1=是, 0=否)")
    private Integer isEnabled;

    /**
     * 安全库存数量
     */
    @TableField(value = "safety_stock")
    @Schema(description="安全库存数量")
    private Integer safetyStock;

    /**
     * 成本
     */
    @TableField(value = "cost")
    @Schema(description="成本")
    private BigDecimal cost;

    /**
     * 创建时间
     */
    @TableField(value = "creation_time")
    @Schema(description="创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date creationTime;

    /**
     * 创建者
     */
    @TableField(value = "create_by")
    @Schema(description="创建者")
    private String createBy;

    /**
     * 修改者
     */
    @TableField(value = "update_by")
    @Schema(description="修改者")
    private String updateBy;

    /**
     * 修改时间
     */
    @TableField(value = "update_time")
    @Schema(description="修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date updateTime;

    /**
     * 物料比例
     */
    @TableField(value = "material_ratio")
    @Schema(description="物料比例")
    private BigDecimal materialRatio;

    @TableField(value = "material_weight")
    @Schema(description="物料重量")
    private BigDecimal materialWeight;

    @TableField(exist = false)
    private List<Bom> boms;
    @TableField(exist = false)
    private List<InventoryTransaction> inventoryTransactions;
}